package datastructure.tree.bst2;

/**
 * 树节点类
 *
 * @author 杨 强
 * @package datastructure.tree.bst2
 * @createTime 2023-03-21 21:48
 */
public class TreeNode {
    /**
     * 唯一key
     * 若希望任意类型作为 key, 则后续可以将其设计为 Comparable 接口
     */
    int key;
    /**
     * 节点的值
     */
    Object value;
    /**
     * 左子树
     */
    TreeNode left;
    /**
     * 右子树
     */
    TreeNode right;

    public TreeNode(int key) {
        this.key = key;
    }

    public TreeNode(int key, Object value) {
        this.key = key;
        this.value = value;
    }

    public TreeNode(int key, Object value, TreeNode left, TreeNode right) {
        this.key = key;
        this.value = value;
        this.left = left;
        this.right = right;
    }
}
